

SBT_SCRIPT = https://gitee.com/marvintau/sbt-install/raw/master/sbt-curl

SBTCMD = $(SBTIMAGE) curl -Ls ${SBT_SCRIPT} > /tmp/sbt && chmod 0775 /tmp/sbt && /tmp/sbt
SBTLOCAL := $(shell command -v sbt 2> /dev/null)
ifndef SBTLOCAL
	SBT=${SBTCMD}
else
	SBT=sbt
endif

source_files = $(wildcard src/main/*.scala)
dir = ./verilog/

SBT_PARAMS = --emission-options=disableMemRandomization,disableRegisterRandomization 

build:
	@echo "Building ..."
	@mkdir -p verilog
	@${SBT} 'run $(SBT_PARAMS) --target-dir $(dir)'

verilog:
	@mkdir -p verilog
	@echo "Generating Verilog Source ..."
	${SBT} 'runMain mult.Top $(SBT_PARAMS)' --target-dir ./verilog'